package com.zqxq.lottery.entity.o2o.news;

import com.baomidou.mybatisplus.plugins.Page;
import com.zqxq.common.utils.DateUtils;
import com.zqxq.common.utils.StrUtils;
import com.zqxq.lottery.entity.po.news.MatchNewsPO;
import com.zqxq.lottery.entity.vo.news.MatchNewsVO;

import java.util.ArrayList;
import java.util.List;

/**
 * @author 苦智
 * @date 2018/9/5 10:56
 * @description
 * @ClassName MatchNewsO2O
 */
public class MatchNewsO2O {
    public static MatchNewsVO toVO(MatchNewsPO matchNewsPO) {
        if (matchNewsPO == null) {
            return null;
        }
        MatchNewsVO matchNewsVO = new MatchNewsVO();
        matchNewsVO.setId(matchNewsPO.getId().toString());
        matchNewsVO.setType(matchNewsPO.getType());
        matchNewsVO.setTitle(matchNewsPO.getTitle());
        matchNewsVO.setTitlePic(matchNewsPO.getTitle_pic());
        matchNewsVO.setAuthor(matchNewsPO.getAuthor());
        matchNewsVO.setSource(matchNewsPO.getSource());
        matchNewsVO.setClickNums(matchNewsPO.getClick_nums());
        matchNewsVO.setKeyword(matchNewsPO.getKeyword());
        matchNewsVO.setGameType(matchNewsPO.getGame_type());
        matchNewsVO.setContent(matchNewsPO.getContent());
        matchNewsVO.setCreateTime(DateUtils.dateToStr(matchNewsPO.getCreate_time(),"yyyy-MM-dd"));
        return matchNewsVO;
    }

    public static List<MatchNewsVO> toVOList(List<MatchNewsPO> list){
         List<MatchNewsVO> result = new ArrayList<>();
         if (list != null && list.size() > 0){
             for (MatchNewsPO po : list) {
                 result.add(toVO(po));
             }
         }
         return result;
    }
}
